package server;

import packets.client.PublicKeyPair;
import packets.server.Certificate;

/**
 * a data structure containing a users information , his public keys for encrypting messages being sent to him
 * or verifying messages sent by him , and his certificate.
 * only the server holds this data structure.
 */
public class User {
	private String _name; 
	private String _password;
	private String _bday;
	private String _city;
	private String _country;
	private byte[] _picture;
	private PublicKeyPair _publicKeyPair;
	private Certificate _certificate;
	
	/**
	 * Creates an instance of User 
	 * @param name uesr's name
	 * @param password user's password
	 * @param bday user's birthday
	 * @param country user's country
	 * @param city user's city
	 * @param picture user's picture
	 * @param publicKeyPair user's public keys
	 * @param certificate user's certificate
	 */
	public User(String name, String password, String bday, String country, String city, byte[] picture,	PublicKeyPair publicKeyPair, Certificate certificate) {
		_name = name;
		_password = password;
		_bday = bday;
		_city = city;
		_country = country;
		_picture = picture;
		_publicKeyPair = publicKeyPair;
		_certificate = certificate;
	}
	/**
	 * 
	 * @return the country of the user
	 */
	public String getCountry() {
		return _country;
	}
	/**
	 * 
	 * @return the name of the user
	 */
	public String getName() {
		return _name;
	}
	/**
	 * 
	 * @return the birthday of the user
	 */
	public String getBday() {
		return _bday;
	}
	/**
	 * 
	 * @return the city of the user
	 */
	public String getCity() {
		return _city;
	}
	/**
	 * method to check if a password is the user's password 
	 * @param password the password to check
	 * @return true if the password is correct
	 */
	public boolean verifyPassword(String password) {
		return _password.equals(password);
	}
	/**
	 * 
	 * @return the public keys for the user
	 */
	public PublicKeyPair getPublicKeyPair() {
		return _publicKeyPair;
	}
	/**
	 * 
	 * @return the user's certificate
	 */
	public Certificate getCertificate() {
		return _certificate;
	}
	
	/**
	 * 
	 * @return a byte array that contains the user's picture
	 */
	public byte[] getPicture() {
		return _picture;
	}
}
